package com.ruoyi.business.exception;

public class CodeMsg {


    private int code;
    private String msg;

    public static CodeMsg SUCCESS = new CodeMsg(0, "success");


    /**
     * 通用错误码
     */
    public static CodeMsg SERVER_ERROR = new CodeMsg(500, "服务端异常");
    public static CodeMsg SERVER_BUSY = new CodeMsg(500, "系统繁忙,请稍后重试");

    public static CodeMsg BIND_ERROR = new CodeMsg(5001, "参数校验异常: %s");
    public static CodeMsg SIGN_ERROR = new CodeMsg(5002, "请使用合法的请求！%s");
    public static CodeMsg NOT_SUPPORT = new CodeMsg(5003, "方法暂不支持");
    public static CodeMsg DATE_ERROR = new CodeMsg(5004, "数据非法，可能是数据");
    public static CodeMsg PARALLEL_ERROR = new CodeMsg(5005, "并发异常，操作终止");
    public static CodeMsg OPERATING_ENVIRONMENT_ERROR = new CodeMsg(5006, "环境异常，操作终止");
    public static CodeMsg TOKEN_ERROR = new CodeMsg(4001, "验签失败");
    public static CodeMsg CLIENT_ERROR = new CodeMsg(4002, "客户端异常");
    public static CodeMsg STORE_INFO_NOT_MATCH = new CodeMsg(4003, "仓库信息不一致,请切换仓库之后再操作");


    /**
     * 登录模块
     */
    public static CodeMsg PASSWORD_ERROR = new CodeMsg(1001, "密码错误");
    public static CodeMsg LOGIN_SESSION_ERROR = new CodeMsg(1002, "登录过期");
    public static CodeMsg LOGIN_ERROR = new CodeMsg(1003, "登录错误");
    public static CodeMsg AUTH_CODE_ERROR = new CodeMsg(1004, "验证码错误");
    public static CodeMsg AUTH_CODE_INVALID = new CodeMsg(1005, "无效的验证码");
    public static CodeMsg EDIT_PASSWORD_ERROR = new CodeMsg(1006, "密码修改失败");
    public static CodeMsg AUTH_CODE_SEND_FAIL = new CodeMsg(1007, "验证码发送失败");
    public static CodeMsg USER_IS_INVALID = new CodeMsg(1008, "登录已失效");
    public static CodeMsg USER_LOGIN_OTHER = new CodeMsg(1009, "已在其他设备登录");
    public static CodeMsg USER_NO_LOGIN = new CodeMsg(1010, "未登录，无法访问");
    public static CodeMsg DATA_SOURCE_OTHER = new CodeMsg(1011, "数据源不一致");
    public static CodeMsg USER_NAME_NULL = new CodeMsg(1012, "登录名为空");


    /**
     * 商品模块
     */
    public static CodeMsg GOODS_IS_NULL = new CodeMsg(8001, "商品不存在");
    public static CodeMsg GOODS_EXCHANGE = new CodeMsg(8002, "没有可以兑换的商品");
    public static CodeMsg GOODS_TYPE_ERROR = new CodeMsg(8003, "您查询的商品类型错误");
    public static CodeMsg GOODS_SHOPPING_ERROR = new CodeMsg(8004, "商品已下架");
    public static CodeMsg GOODS_IS_PURCHASED = new CodeMsg(8005, "商品已经购买过，无需再次购买");
    public static CodeMsg GOODS_BUY_NUMBER_ERROR = new CodeMsg(8006, "商品购买数量错误");
    public static CodeMsg GOODS_IS_LESS = new CodeMsg(8007, "商品库存不足");
    public static CodeMsg GOODS_OVER_NUMBER = new CodeMsg(8008, "购物数量超出商品库存");
    public static CodeMsg LIST_DELIVE_IS_NULL = new CodeMsg(8009, "发货单信息不存在,该货品无法装车!");


    /**
     * 用户模块
     */
    public static CodeMsg REGISTER_ERROR = new CodeMsg(9001, "该手机号已经被注册，请重新输入");
    public static CodeMsg PHONE_NOT_EXIST = new CodeMsg(9002, "手机号号码不存在，请重新输入");
    public static CodeMsg NEW_AND_OLD_REPETITION = new CodeMsg(9003, "新密码不能与旧密码重复，请重新输入");
    public static CodeMsg USER_IS_NULL = new CodeMsg(9004, "用户不存在");
    public static CodeMsg USERID_IS_NULL = new CodeMsg(9004, "用户id不能为空");
    public static CodeMsg USER_ADDRESS_ADD_ERROR = new CodeMsg(9005, "添加收货地址出错");
    public static CodeMsg USER_ADDRESS_IS_NULL = new CodeMsg(9006, "用户收货地址不存在");
    public static CodeMsg PARENT_USER_IS_NULL = new CodeMsg(9007, "没有查询到您的推荐用户！");
    public static CodeMsg USER_IS_BANNED = new CodeMsg(9008, "您已被管理员封禁！");
    public static CodeMsg SPLIT_STAFF_IS_NULL = new CodeMsg(9009, "分润员工不存在");
    public static CodeMsg MASTER_ERROR = new CodeMsg(9010, "此用户是子账号 不能设置主账号");
    public static CodeMsg SHOPPING_DATA_ERROR = new CodeMsg(9011, "购物车数据异常,请刷新购物车数据后重试");
    public static CodeMsg SHOPPING_CART_DEL_ERROR = new CodeMsg(9012, "商品已下架,请刷新购物车数据后重试");
    /**
     * 后台模块
     */
    public static CodeMsg KEY_IS_EXIST = new CodeMsg(100000, "关键字对应关系已存在！");
    public static CodeMsg ORDER_IS_EXIST = new CodeMsg(100001, "订单号不存在！");
    public static CodeMsg AFTER_IS_SPLIT_ACCOUNT = new CodeMsg(100002, "该订单已经分过账不允许操作售后！");
    public static CodeMsg AFTER_IS_NO_SUCCEED = new CodeMsg(100003, "该订单不是完成状态无需开通售后！");
    public static CodeMsg AFTER_IS_SUCCEED = new CodeMsg(100004, "该订单是完成状态无需关闭售后！");
    public static CodeMsg AFTER_IS_JUDGMENT = new CodeMsg(100005, "该订单已经判责过售后无法开通！");
    public static CodeMsg AFTER_IS_NO_OPEN = new CodeMsg(100006, "该订单售后通道没有开通无需关闭！");
    public static CodeMsg AFTER_IS_ERROR = new CodeMsg(100007, "售后状态异常！");

    /**
     * 订单模块
     */
    public static CodeMsg ORDER_NOT_EXIST = new CodeMsg(110001, "订单不存在");
    public static CodeMsg ORDER_CLOSE_TIMEOUT = new CodeMsg(110002, "订单关闭超时");
    public static CodeMsg REFUND_FAILURE = new CodeMsg(110003, "退款失败");
    public static CodeMsg ORDER_SENDED = new CodeMsg(110004, "订单已发货");
    public static CodeMsg PRINT_NOT_EXIST = new CodeMsg(110005, "面单不存在");
    public static CodeMsg CURRENT_STATUS_NOT_REFUND = new CodeMsg(110006, "当前状态不能退款");
    public static CodeMsg DELIVERY_NOTE_NOT_EXIST = new CodeMsg(110006, "发货单不存在");
    public static CodeMsg VEHICLE_OVER_WEIGHT = new CodeMsg(110008, "车辆超重");

    public static CodeMsg WAREHOUSE_ERROR = new CodeMsg(120001, "获取切换仓库不合法");
    public static CodeMsg DELIVER_BATCH_NOT_MATCH = new CodeMsg(120002, "批次信息不一致");


    //活动模块
    public static CodeMsg ENABLE_ERROR = new CodeMsg(130000, "已存在开启的任务");


    // 打印模块
    public static CodeMsg PRINT_LINES_ERROR = new CodeMsg(140000, "线路信息有误");
    public static CodeMsg PRINT_GOODS_ERROR = new CodeMsg(140001, "商品信息有误");
    public static CodeMsg PRINT_ORDER_ERROR = new CodeMsg(140002, "订单信息有误");
    public static CodeMsg PRINT_ORDER_ERROR_01 = new CodeMsg(140003, "送出信息有误，买手店铺id不能为空");


    // 物流模块
    public static CodeMsg GOODS_IS_LOAD = new CodeMsg(1700001, "该货品已经装车,请勿重复装车");


    // 财务模板
    public static CodeMsg SUBJECT_NAME_REPEAT = new CodeMsg(150001, "科目名称已存在");


    // 扣款模块
    public static CodeMsg DEDUCTION_PRICE_OVER = new CodeMsg(160001, "扣款金额不能大于货品金额");
    public static CodeMsg SHOP_IS_NULL = new CodeMsg(160002, "店铺信息不存在");
    public static CodeMsg DEDUCTION_PRICE_ERROR = new CodeMsg(160003, "扣款金额必须大于零");


    //直供分享二维码
    public static CodeMsg BUILDER_CODE_BY_SELLER = new CodeMsg(150000, "送货单信息有误  请传入送货单id");
    public static CodeMsg BUILDER_CODE_BY_SELLER_OVER = new CodeMsg(150001, "剩余打印数量不足");


    // 远程调用模块
    public static CodeMsg EXIST_SMALL_WAREHOUSE_INFO = new CodeMsg(170000, "存在小仓关联此截单信息,无法删除");
    public static CodeMsg FEIGN_ERROR = new CodeMsg(160000, "远程调用失败");
    public static CodeMsg EXIST_AFTER_SALES = new CodeMsg(180000, "当前货号列表中存在已提交的售后信息");

    public static CodeMsg INSERT_ERROR = new CodeMsg(170001, "保存异常！");
    public static CodeMsg JUDGEMENT_PRICE_ERROR = new CodeMsg(170002, "判责金额不正确！");
    public static CodeMsg ORDER_IS_ERROR = new CodeMsg(170003, "订单信息错误");
    public static CodeMsg AFTER_SALE_INFO_UPDATE_ERROR = new CodeMsg(170003, "售后信息更新错误");
    public static CodeMsg NOT_SUPPORTED_MANUAL_SPLIT = new CodeMsg(170004, "不支持手动结算,请先开通此功能");
    private CodeMsg() {
    }

    public CodeMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public CodeMsg fillArgs(Object... args) {
        int code = this.code;
        String message = String.format(this.msg, args);
        return new CodeMsg(code, message);

    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
